<%--
  Created by IntelliJ IDEA.
  User: 45311
  Date: 2021/3/28
  Time: 9:48
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="bootstrap-iso">
    <div class="col-md-12">
        <nav class="navbar navbar-default navbar-inverse navbar-fixed-top">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header  ">
                    <button type="button" class="navbar-toggle collapsed " data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only ">Restaurant</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>

                    <a class="navbar-brand " href="${pageContext.request.contextPath}/index123">Restaurant</a>

                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class=" login123"><a href="${pageContext.request.contextPath}/user123/menuindex/1">菜单</a></li>
                        <li class=" login123"><a href="${pageContext.request.contextPath}/user123/cart">购物车</a></li>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <%--如果用户还没有登录，显示     【登录 和注册的菜单】 --%>
                        <c:if test="${empty sessionScope.user}">
                            <li class="login123" ><a href="${pageContext.request.contextPath}/tologin">登录</a> </li>
                            <li class="login123" ><a href="${pageContext.request.contextPath}/toregist">注册</a></li>
                        </c:if>
                        <%--如果已经登录，则显示 登录 成功之后的用户信息。--%>
                        <c:if test="${not empty sessionScope.user}">
                            <li class="login123" ><a href="${pageContext.request.contextPath}/tologin">欢迎${sessionScope.user.username}</a></li>
                            <li class="login123" ><a href="${pageContext.request.contextPath}/user123/order">我的订单</a></li>
                            <li class="login123" ><a href="${pageContext.request.contextPath}/logout">注销</a></li>
                        </c:if>

                    </ul>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>
    </div >
</div>